<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class Header extends CWidget
{
	public function run()
	{
		$this->render( 'header' );
	}

	public function getMenu( $class = "" )
	{
		$hMenu = '<ul class="' . $class . '">';
		$classSelected = 'selected';
		$url = Yii::app()->request->url;
		$url = explode('/', $url);		
		$counter = 0;
		foreach( Yii::app()->params['categories'] as $menu )
		{
			$hMenu .= '<li class="'.$menu['class'] . ' ' . ($url[1] == $menu['pageUrl'] ? $classSelected : '') .'">' . CHtml::link( $menu['menuTitle'], '/' . $menu['pageUrl'] ) . '</li>'."\r";
		}
		return $hMenu . '</ul>';
	}
}